package com.zhu.algorithm.sort;


import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: zhujiabao
 * @Date: 2021/12/23/16:30
 * @Description: 主函数类
 */
public class mainSort {

    /*public int[] sort(int[] sourceArray){
        // 对 arr 进行拷贝，不改变参数内容
        int[] arr = Arrays.copyOf(sourceArray, sourceArray.length);

        long A=System.currentTimeMillis();

        long B=System.currentTimeMillis();
        System.out.println("选择排序所耗时间： "+(B-A)+"ms");

        return arr;

    }*/

    public static void main(String[] args){

        int[] sourceArray = {125,585,3,44,38,5,47,15,36,25,27,2,46,4,19,50,48,45,24,35,75,458,66,98,233};

        //当源数组有一万个元素时
//        int[] sourceArray = new RandomArray().randomArray_1000000();
        //指定有多少个乱序元素
//        int[] sourceArray = new RandomArray().randomArray(10001);
//        System.out.println(Arrays.toString(sourceArray));

        //10.基数排序
//        new RadixSort().sort(sourceArray);
//        System.out.println(Arrays.toString(new RadixSort().sort(sourceArray)));

        //6.快速排序
//        new QuickSort().sort(sourceArray);
        System.out.println(Arrays.toString(new QuickSort().sort(sourceArray)));

        //5.归并排序
//        new MergeSort().sort(sourceArray);
        System.out.println(Arrays.toString(new MergeSort().sort(sourceArray)));
//
        //4.希尔排序
//        new ShellSort().sort(sourceArray);
//        System.out.println(Arrays.toString(new ShellSort().sort(sourceArray)));

        //3.插入排序
//        new InsertionSort().sort(sourceArray);
//        System.out.println(Arrays.toString(new InsertionSort().sort(sourceArray)));

        //2.选择排序
//        new SelectionSort().sort(sourceArray);
//        System.out.println(Arrays.toString(new SelectionSort().sort(sourceArray)));

        //1.冒泡排序
//        new bubbleSort().sort(sourceArray);
//        System.out.println(Arrays.toString(new bubbleSort().sort(sourceArray)));

    }


}
